package cell

import (
	"github.com/treelab/updatecolumn/models"
)

// InstanceType of cell
func InstanceType() int32 {
	return models.Email
}


  setCellValue({ cell, action }: ICCAction, o?: CommonOptions) {
    cell.text = (action.value as EmailCellValue).text;
    return this;
  }

  cellValueToCollaborator({ cell, column, userGroup }: { cell: Cell; column: Column; userGroup: any }) {
    const userGroups = userGroup?.groups || [];
    const groups: any[] = [];
    const emails = (cell.text || '').split(',');
    _.forEach(emails, email => {
      const find = this.findCollaboratorGroupAndUser(userGroups, (email || '').trim(), ['email']);
      if (find) {
        groups.push(find);
      }
    });
    return _.uniq(groups);
  }

